 <!-- 新闻列表 -->
<script lang="ts">
export default {
  name: "zwzznewsList",
};
</script>
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">
      新闻列表
    </p>
    <div>
      <dxtable :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale"
        sonRouter="zwzzjournalism"></dxtable>
    </div>
  </div>
  <n-modal v-model:show="showModal" preset="card" class="dsfsdrewrewe" >
    <template #header>
      <div>浏览二维码</div>
    </template>
    <div>
      <img :src="qcosertt" class="fsdfereertr">
    </div>
    <template #action>
      <div class="tr">
        <n-button @click="showModal=false"> 关闭 </n-button>
      </div>
    </template>
  </n-modal>
</template>
<script lang='ts' setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf } from "../../util/index";
import { h, ref, reactive, onBeforeUpdate } from "vue";
const props = defineProps({
  pup: { type: String },
});
const showModal = ref(false)
const qcosertt = ref()
let portUrl = "jwzz/journalism";
let headBtn = [];
const zdList = ref()
const databale = ref();
const videourl = ref()
const typeli = ref([])
const initeer = () => {
  databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
// 弹窗公用该列表
let dataJson = reactive([
  {
    title: "id",
    key: "id",
    width: 50,
  },

  {
    title: "新闻标题",
    search: true, // 是否在搜索栏展示
    key: "title",
    width: 400,
  },
  {
    title: "封面",
    key: "doctor",
    render(row) {
      // dxpost(portUrl,{id:row.id,qcCode:})
      return h('span', {
        class: "ls sz", onClick: async () => {
          qcosertt.value = row.cover
          showModal.value = true
        }
      }, "浏览封面")
    }
  },
  {
    title: "分类",
    search: true, // 是否在搜索栏展示
    type: "select",
    options: [],
    key: "fenlei",
    render(row){
     try{
      return typeli.value.filter(a=>a.value==row.fenlei)[0].label
     }catch(e){
      
     }
    }

  },
  

  {
    title: "排序",
    width: 100,
    render(row) {
      row.databaseName = "zwzznewsList";
      return h(sort, {
        row,
        onCallBack: () => {
          initeer();
        },
      });
    },
  },
  {
    title: "添加时间",
    key: "addTime",
    width: "140",
    type: "daterange",
  },
]);

const qx = {
  DeletePermissionID: "zwzznewsListdel", //删除
  EditPermissionIdentifier: "zwzznewsListbj", // 编辑
  NewPermissionIdentifier: "zwzznewsListxz", // 新建
  ViewPermissionID: "zwzznewsListck", // 查看
};
const getcasetype = async () => {
  const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'zjjwnewsClassification' })

  dataJson[3].options = [
    {
      label: "全部",
      value: ""
    },
    ...data
  ]
  typeli.value = data
  // ishjwoer.value = true
}
getcasetype()

</script>
<style scoped>
.fsdfereertr{
  width: 100%;
  height: 360px;
}
</style>
  
  
  